import  {tuple} from "../utils"
// ExtractPropTypes:vue类型转为ts的
import type { ExtractPropTypes, PropType } from 'vue';
const types=tuple("danger","primary","success");
const  sizes=tuple("lg","sm","md");
const shapes=tuple("round","circle");
// 快速定义类型的工具
import PropTypes from '../utils/vueType';
const  buttonProps=()=>({
    size:PropTypes.oneOf(sizes),
    type:PropTypes.oneOf(types),
    shape:PropTypes.oneOf(shapes),
    loading: {
        type: [Boolean, Object] as PropType<boolean | { delay?: number }>,
        default: (): boolean | { delay?: number } => false,
    },
    disabled: PropTypes.looseBool,
    onclick:{
        type: Function as PropType<(event: MouseEvent) => void>,
    }
})
export type typesTs=typeof types[number];
export type sizesTs=typeof sizes[number];
export type shapessTs=typeof shapes[number];
// Partial<type>表示类型可选 ReturnType<typeof 函数> type的作用就是js ts的互转
export type ButtonPropsTs = Partial<ExtractPropTypes<ReturnType<typeof buttonProps>>>;
//返回的是函数
export default buttonProps;
